# Contributor: Marian Buschsieweke <marian.buschsieweke@posteo.net>
# Maintainer: Marian Buschsieweke <marian.buschsieweke@posteo.net>
pkgname=py3-zipfile2
_pkgname=zipfile2
pkgver=0.0.12
pkgrel=0
pkgdesc="An improved ZipFile class for python"
url="https://github.com/cournape/zipfile2"
license="PSF-2.0"
arch="all"
depends="
	python3
	"
makedepends="
	py3-gpep517
	py3-installer
	py3-setuptools
	py3-wheel
	"
checkdepends="
	py3-pytest
	"
subpackages="
	$pkgname-pyc
	"
source="
	$pkgname-$pkgver.tar.gz::https://github.com/cournape/zipfile2/archive/refs/tags/v$pkgver.tar.gz

	0001-adapt-for-zipfile-api-change.patch
	"
builddir="$srcdir/$_pkgname-$pkgver"

build() {
	gpep517 build-wheel \
		--wheel-dir dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages "$srcdir"/testenv
	"$srcdir"/testenv/bin/python3 -m installer dist/*.whl

	PATH="$srcdir/testenv/bin:$PATH" "$srcdir"/testenv/bin/python3 \
		-m pytest -v
}

package() {
	python3 -m installer -d "$pkgdir" \
		"$builddir"/dist/*.whl
}

sha512sums="
a1d7e8bb102b046c4a6d363c24d3f85dae1373ff3c790c3b5bdfdae337569f9e32db6e69023a0adcc0141594a18fb1af970bc9179161d3e83fbe922e2ac46e5d  py3-zipfile2-0.0.12.tar.gz
7401caf4c3f55195a930e308d944f9358954548031ba0f6f757cba50ed3a5d87f8dfdc92f2245d20c3030f216affcfc073a138bb63fe4905188c73b3a0d109e2  0001-adapt-for-zipfile-api-change.patch
"
